import { createParamDecorator, ExecutionContext } from '@nestjs/common';
import { Socket } from 'socket.io';

export const User = createParamDecorator<'random' | 'room_id' | 'user_name'>(
  (data, ctx: ExecutionContext) => {
    const client = ctx.switchToWs().getClient<Socket>();
    // console.log(client.handshake);
    return client.handshake.query[data];
  },
);
